package com.lzhl.buildjar.po;

/**
 * @author 李柱良(@柱子的日月)
 * @date 2014/6/19
 */
public class Category {
    //SQLITE数据库的编码是从1开始的
    public static Category ROOT = new Category(0, "方案");

    private long id = -1;
    private Category parent;
    private int seq = -1;
    private String name;

    public Category() {
    }

    public Category(long id) {
        this.id = id;
    }

    public Category(long id, String name) {
        this.id = id;
        this.name = name;
    }

    public String toString() {
        return this.name;
    }

    @Override
    public boolean equals(Object obj) {
        if(!(obj instanceof Category)) {
            return false;
        }

        Category category = (Category) obj;
        return this.id == category.getId();
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Category category = new Category(id, name);
        category.setParent(parent);
        category.setSeq(seq);

        return category;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Category getParent() {
        return parent;
    }

    public void setParent(Category parent) {
        this.parent = parent;
    }

    public int getSeq() {
        return seq;
    }

    public void setSeq(int seq) {
        this.seq = seq;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}
